package per.turtle.common.core.constant;

/**
 * 缓存的key 常量
 *
 * @author turtle
 */
public class CacheConstants {

    /**
     * 令牌自定义标识
     */
    public static final String HEADER = "Authorization";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 权限缓存前缀
     */
    public final static String LOGIN_TOKEN_KEY = "login_tokens";

    /**
     * 用户ID字段
     */
    public static final String DETAILS_USER_ID = "user_id";

    /**
     * 用户名字段
     */
    public static final String DETAILS_USERNAME = "username";

    /**
     * 授权信息字段
     */
    public static final String AUTHORIZATION_HEADER = "authorization";

    /**
     * 参数管理 cache key
     */
    public static final String SYS_CONFIG_KEY = "sys_config";

    /**
     * 字典管理 cache key
     */
    public static final String SYS_DICT_KEY = "sys_dict";

    /**
     * 部门管理 cache key
     */
    public static final String SYS_DEPT_KEY = "sys_dept";

    /**
     * 验证码 redis key
     */
    public static final String CAPTCHA_CODE_KEY = "captcha_codes";

    /**
     * 验证码有效期（秒）
     */
    public static final long CAPTCHA_EXPIRATION = 60;

    /**
     * 令牌有效期（分钟）
     */
    public final static long TOKEN_EXPIRE = 720;

    /**
     * 连接符 ::
     */
    private static final String VALUE_KEY_JOINER = "::";

    public static String getCacheKey(String preKey, String sufKey) {
        return preKey + VALUE_KEY_JOINER + sufKey;
    }

}
